package com.roncoo.education.course.service.api;

import javax.validation.constraints.NotNull;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.roncoo.education.common.core.base.Page;
import com.roncoo.education.common.core.base.Result;
import com.roncoo.education.course.service.api.biz.ApiExperimentBiz;
import com.roncoo.education.course.service.api.req.ApiExperimentPageReq;
import com.roncoo.education.course.service.api.resp.ApiExperimentPageResp;
import com.roncoo.education.course.service.biz.ExperimentBiz;
import com.roncoo.education.course.service.biz.req.ExperimentReq;
import com.roncoo.education.course.service.biz.resp.ExperimentResp;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;

/**
 * API-实验信息
 *
 * @author wujing
 * @date 2023-07-20
 */
@Api(tags = "API-实验信息")
@RestController
@RequiredArgsConstructor
@RequestMapping("/course/api/experiment")
public class ApiExperimentController {

    @NotNull
    private final ApiExperimentBiz biz;

    @NotNull
    private final ExperimentBiz experimentBiz;
    
    /**
     * 实验信息列表接口
     *
     * @author fengyw
     */
    @ApiOperation(value = "列表和搜索接口", notes = "根据条件进行课程列出")
    @RequestMapping(value = "/search", method = RequestMethod.POST)
    public Result<Page<ApiExperimentPageResp>> searchForPage(@RequestBody ApiExperimentPageReq req) {
        return biz.searchForPage(req);
    }

    /**
     * 实验详情接口
     */
    @ApiOperation(value = "实验详情接口", notes = "根据实验ID获取课程信息")
    @RequestMapping(value = "/view", method = RequestMethod.POST)
    public Result<ExperimentResp> view(@RequestBody ExperimentReq req) {
        return experimentBiz.view(req, null, null);
    }
}
